package com.panopset.gui;

import javax.swing.table.DefaultTableModel;

import com.panopset.java.Version;

/**
 * Panopset list editor.
 *
 * @author Karl Dinwiddie
 *
 */
public final class ListEditor extends AbstractTableEditor {

    /**
     * @param defaultResourcePath Default resource path.
     * @param fileName File name.
     */
    public ListEditor(final String defaultResourcePath,
            final String fileName) {
        super(defaultResourcePath, fileName);
    }

    @Override
    protected void doAdd() {
        getModel().addRow(new String[] {"" });
    }

    @Override
    protected DefaultTableModel createModel() {
        return new DefaultTableModel(0, 1) {
            @Override
            public String getColumnName(final int columnIndex) {
                switch (columnIndex) {
                case 0:
                    return getValueColumnHeader();
                default:
                    return "undefined";
                }
            }

            /**
             * Serial version id.
             */
            private static final long serialVersionUID = Version.UNI_VERSION;
        };
    }
}
